<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace AlibabaCloud\Client\Request\Traits;

trait ClientTrait
{
    private static $config = [];
    public static function config($config)
    {
        self::$config = $config;
    }
    public function credential()
    {
        if($this instanceof \AlibabaCloud\Client\Credentials\Requests\AssumeRole || $this instanceof \AlibabaCloud\Client\Credentials\Requests\GenerateSessionAccessKey) {
            return $this->httpClient()->getCredential();
        }
        $timeout = isset($this->options["timeout"]) ? $this->options["timeout"] : \AlibabaCloud\Client\Request\Request::TIMEOUT;
        $connectTimeout = isset($this->options["connect_timeout"]) ? $this->options["connect_timeout"] : \AlibabaCloud\Client\Request\Request::CONNECT_TIMEOUT;
        return $this->httpClient()->getSessionCredential($timeout, $connectTimeout);
    }
    public function httpClient()
    {
        if(!\AlibabaCloud\Client\AlibabaCloud::all()) {
            if(\AlibabaCloud\Client\Credentials\Providers\CredentialsProvider::hasCustomChain()) {
                \AlibabaCloud\Client\Credentials\Providers\CredentialsProvider::customProvider($this->client);
            } else {
                \AlibabaCloud\Client\Credentials\Providers\CredentialsProvider::defaultProvider($this->client);
            }
        }
        return \AlibabaCloud\Client\AlibabaCloud::get($this->client);
    }
    public function mergeOptionsIntoClient()
    {
        $this->options = \AlibabaCloud\Client\Support\Arrays::merge([$this->httpClient()->options, $this->options]);
    }
}

?>